package cn.tedu.boot041.controller;

import cn.tedu.boot041.entity.Product;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {
    @RequestMapping("/helloAxios")
    public String helloAxios(String name,int age){
        return "GET!]"+name+":"+age;
    }

    // post请求如果携带的是自定义JS对象,接收参数时需要时加 @RequestBody 注解,如果不加注解,则接收到的参数为null
    @RequestMapping("/postAxios")
    public String postAxios(@RequestBody Product product){
        return "POST!";
    }

}
